package weeek3;



    /**
     * Represents a node in a linked list.
     *
     * @author Lewis and Chase
     * @version 4.0
     */
    public class LinearNode1<T>
    {
        private LinearNode1<T> next;
        private LinearNode1<T> previous;
        private T element;

        /**
         * Creates an empty node.
         */
        public LinearNode1()
        {
            previous=null;
            next = null;
            element = null;
        }

        /**
         * Creates a node storing the specified element.
         * @param elem element to be stored
         */
        public LinearNode1(T elem)
        {
            next = null;
            element = elem;
        }

        /**
         * Returns the node that follows this one.
         * @return reference to next node
         */
        public LinearNode1<T> getNext()
        {
            return next;
        }

        /**
         * Sets the node that follows this one.
         * @param node node to follow this one
         */
        public void setNext(LinearNode1<T> node)
        {
            next = node;
        }
        public void setPrevious(LinearNode1<T> node)
        {
            previous=node;
        }
        public LinearNode1<T> getPrivious()     {
            return previous;
        }
        /**
         * Returns the element stored in this node.
         * @return element stored at the node
         */
        public T getElement()
        {
            return element;
        }

        /**
         * Sets the element stored in this node.
         * @param elem element to be stored at this node
         */
        public void setElement(T elem)
        {
            element = elem;
        }
    }


